<template>
  <div id="app">
    <!-- 更新一个组件 ，本质是修改key  -->
    <Header :key="updateKey" @updateKeyFn="updateKeyFn" />
    <Nav />
    <router-view @updateKeyFn="updateKeyFn" />
    <Footer />
    <Login @updateKeyFn="updateKeyFn" />
    <transition name="fade">
      <Toast v-show="$store.state.toast.show" />
    </transition>

  </div>
</template>
<script>
// @ is an alias to /src
import Header from "@/components/Header.vue";
import Nav from "@/components/Nav.vue";
import Footer from "@/components/Footer.vue";
import Login from "@/components/Login.vue";
import Toast from "@/components/Toast.vue";

export default {
  data() {
    return {
      updateKey: 0,
    }
  },
  methods: {
    // 更新header
    updateKeyFn() {
      // console.log(querry);
      console.log(1);
      this.updateKey++;
    }
  },
  components: {
    Header,
    Nav,
    Footer,
    Login,
    Toast,
  },
};
</script>
<style lang="less">
body {
  background: #f5f5f5;
}
.fade-enter-active, 
.fade-leave-active {
  transition: opacity 0.5s linear;
}
.fade-enter, .fade-leave-to /* .fade-leave-active below version 2.1.8 */ {
  opacity: 0;
}
.fade-enter-to, 
.fade-leave {
  opacity: 1;
}
img[lazy="loading"] {
  display: block;
  width: 30% !important;
  height: 30% !important;
  margin: 0 auto;
}
</style>
